package com.mingshine.cloud.test;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
 
/**
 * 消息消费者 匹配路由键:
 * @Class TopicXingConsumer
 * @Author 作者姓名:LiuXing
 * @Version 1.0
 * @Date 创建时间：2019-05-22 10:12
 * @Direction 类说明
 */
//@Component
public class TopicXingConsumer {
 
    public static final Logger logger = LoggerFactory.getLogger( TopicXingConsumer.class ) ;
 
    /****
     * 监听两个队列，一旦此队列出现数据，则自动消费此队列的数据
     * @param message
     * @throws Exception
     */
    //@RabbitListener(queues = { QueueConfig.QUEUE_DIRECT_NAME , QueueConfig.QUEUE_DIRECT_NAME1 }, containerFactory = "rabbitListenerContainerFactory")
    @RabbitListener(queues = { QueueConfig.COM_TOPIC_QUEUE_XING }, containerFactory = "rabbitListenerContainerFactory")
    public void handleMessage(String message) throws Exception {
        // 处理消息
        logger.info("TOPIC队列：{} 匹配模式消费者： 接收到消息如下：{} " , QueueConfig.COM_TOPIC_QUEUE_XING  , message);
    }
 
}